package com.orphan.marketFront.service;

import com.orphan.marketFront.po.Order;
import com.orphan.marketFront.po.OrderDetail;
import com.orphan.marketFront.po.ReturnsPo;
import com.orphan.marketFront.vo.OrderDetailVo;
import com.orphan.marketFront.vo.OrderReturnsVo;
import com.orphan.marketFront.vo.OrderVo;
import com.orphan.util.dto.ReturnsDetailsDto;
import com.orphan.util.dto.OrderDto;

import java.util.Date;
import java.util.List;

public interface IOrderService {
    List<OrderVo> listAll(long userId);
    List<OrderVo> queryByTime(String orderTime);
    int remove(String orderId);
    List<OrderDetailVo> orderDetailList(String orderNo);
    OrderReturnsVo orderReturns(String orderNo, String goodsName);
    int addOrderReturns(String orderId, String returnsNo, Date returnsTime);
    List<ReturnsPo> getReturnsId(String orderId);
    int addReturnsDetails(Long orderReturnsId,String goodsType,String goodsName,
                          Double goodsPrice,int goodsCount,int goodsOrderStatus);
    int updateStatus(int goodsOrderStatus,String goodsName);
    List<ReturnsDetailsDto> returnsDetails(String orderId);

    /**
     * 查询订单
     * @param orderId 订单id
     * @return
     */
    Order selectOrderById(String orderId);

    /**
     * 根据订单id查询订单商品明细
     * @param orderId
     * @return
     */
    List<OrderDetail> selectOrderDetailByOrderId(String orderId);

    /**
     * 修改订单支付状态
     * @param orderId 订单编号
     * @param payStatus 支付状态
     * @return
     */
    Integer updateOrderPayStatus(String orderId,Integer payStatus);

    /**
     * 新增订单
     * @param orderDto 新的订单
     * @return 受影响的行数
     */
    Integer insertOrder(OrderDto orderDto);

    /**
     * 将订单商品持久化到数据库
     * @param orderDto
     * @return
     */
    Integer insertOrderDetail(OrderDto orderDto);

    /**
     * 将数据库订单信息组装为传输对象
     * @param order
     * @param OrderDetailList
     * @return
     */
    OrderDto orderDtoParse(Order order,List<OrderDetail> OrderDetailList);

    /**
     * 将传输的订单表中的订单信息转化为订单表的po
     * @param orderDto
     * @return
     */
    Order tableOrderParse(OrderDto orderDto);

    /**
     * 将传输的订单表中的商品明细转化为订单详情表的po
     * @param orderDto
     * @return
     */
    List<OrderDetail> tableOrderDetailParse(OrderDto orderDto);
}
